package io.gitee.hechenl.fastiotreport.controller.validator;

import io.gitee.hechenl.fastiotreport.domain.dto.ConfigMetricUpSertDTO;

public class ConfigMetricValidator {

    public static void validInsertOrUpdate(ConfigMetricUpSertDTO request) {
        /*request.getItems().forEach(item -> {
            if (CollectionUtils.isEmpty(item.getMetricGroup())) {
                throw new RuntimeException("分组不能为空");
            }


            //if (item.getMetricExpr())

            String metricExpr = item.getMetricExpr();
            String[] split = item.getMetricExpr().split("/");

            String energy = split[0];
            String product = split[1];

            if (RegexConstants.pattern1.matcher(energy).matches()
                    || RegexConstants.pattern2.matcher(energy).matches()
                    || RegexConstants.pattern3.matcher(energy).matches()
                    || RegexConstants.pattern4.matcher(energy).matches()) {
                return;
            }
            throw new RuntimeException("公式错误，只支持格式：(111+222+333)-(444+555)、111+222+333、111-222、111");
        });*/
    }
}
